import ReactDOM from 'react-dom/client';
import {Provider} from 'react-redux';
import reportWebVitals from './reportWebVitals';
import {BrowserRouter} from 'react-router-dom';
import {renderRoutes} from 'react-router-config';
import {routes} from './router';
import store from './redux';

import 'acud/dist/acud.min.css';
import './index.css';

/**
 *  路由第一种写法
 *  import Router from './router';
 *  <React.StrictMode>
 *     <Router/>
 *  </React.StrictMode>
 *
 */

// 路由使用hooks
const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);

root.render(
    <Provider store={store}>
        <BrowserRouter>{renderRoutes(routes)}</BrowserRouter>
    </Provider>
);

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
